<?php
class Form_unionsadd extends QForm
{
	function __construct($action)
	{
		// 调用父类的构造函数
		parent::__construct(__CLASS__, $action);
		// 从配置文件载入表单
		$filename = rtrim(dirname(__FILE__), '/\\') . DS . __CLASS__ .'.yaml';
		$this->loadFromConfig(Helper_YAML::loadCached($filename));
		$this->addValidations(Product::meta());
		//dump($this);
		//$this['userlevel']->addValidations(array($this,'validate_level'),'已经存在此等级的奖励');
	}
	
	static function validate_level($param)
	{
		return !(bool)(Unionsetting::find('userlevel = ?',$param)->getCount());
	}
}